package com.example.photograph.service.impl;

import com.example.photograph.domain.SysDepartment;
import com.example.photograph.mapper.SysDepartmentMapper;
import com.example.photograph.service.ISysDepartmentService;
import com.example.photograph.utils.Convert;
import com.example.photograph.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 部门管理Service业务层处理
 * 
 * @author wuyj
 * @date 2021-03-06
 */
@Service
public class SysDepartmentServiceImpl implements ISysDepartmentService 
{
    @Autowired
    private SysDepartmentMapper sysDepartmentMapper;

    /**
     * 查询部门管理
     * 
     * @param departmentId 部门管理ID
     * @return 部门管理
     */
    @Override
    public SysDepartment selectSysDepartmentById(Long departmentId)
    {
        return sysDepartmentMapper.selectSysDepartmentById(departmentId);
    }

    /**
     * 查询部门管理列表
     * 
     * @param sysDepartment 部门管理
     * @return 部门管理
     */
    @Override
    public List<SysDepartment> selectSysDepartmentList(SysDepartment sysDepartment)
    {
        return sysDepartmentMapper.selectSysDepartmentList(sysDepartment);
    }

    /**
     * 新增部门管理
     * 
     * @param sysDepartment 部门管理
     * @return 结果
     */
    @Override
    public int insertSysDepartment(SysDepartment sysDepartment)
    {
        sysDepartment.setCreateTime(DateUtils.getNowDate());
        return sysDepartmentMapper.insertSysDepartment(sysDepartment);
    }

    /**
     * 修改部门管理
     * 
     * @param sysDepartment 部门管理
     * @return 结果
     */
    @Override
    public int updateSysDepartment(SysDepartment sysDepartment)
    {
        sysDepartment.setUpdateTime(DateUtils.getNowDate());
        return sysDepartmentMapper.updateSysDepartment(sysDepartment);
    }

    /**
     * 删除部门管理对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysDepartmentByIds(String ids)
    {
        return sysDepartmentMapper.deleteSysDepartmentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除部门管理信息
     * 
     * @param departmentId 部门管理ID
     * @return 结果
     */
    @Override
    public int deleteSysDepartmentById(Long departmentId)
    {
        return sysDepartmentMapper.deleteSysDepartmentById(departmentId);
    }
}
